<template>
	<view>
		<view class="u-demo">通过读取个人中心的用户信息自动生成的就诊人卡片</view>
		<uni-card @click="xinjian">
			<view  style="text-align: center;">
				<image src="../../../../static/uview/example/min_button.png" style="width: 100rpx;height: 100rpx;"></image>
				<view>新建就诊人</view>
			</view>
		</uni-card>
		<uni-card v-for="(item,index) in content" @click="xiugai(index)">
			<view class="u-flex" style="justify-content: space-between;">
				<view>姓名:{{item.name}}</view>
				<image @click.stop="jizhen(index)" src="../../../../static/right.png" style="width: 50rpx;height: 50rpx;"></image>
			</view>
			<view>手机号:{{fillstr(item.tel)}}</view>
			<view>身份证号:{{fillstr(item.cardId)}}</view>
		</uni-card>
	</view>
</template>

<script>
	import api from '../../../../commer/apiURL.js'
	export default {
		data() {
			return {
				base:api.baseurl,
				content:[],
			}
		},
		onLoad(options) {
			this.getren()
		},
		methods: {
			jizhen(index){
				uni.setStorage({
					key:'jiuzhenCrd',
					data:this.content[index],
					success: (res) => {
						uni.navigateTo({
							url:'keshilist'
						})
					}
				})
			},
			xiugai(index){
				uni.setStorage({
					key:'jiuzhenCrd',
					data:this.content[index],
					success: (res) => {
						uni.navigateTo({
							url:'xinjianren'
						})
					}
				})
			},
			xinjian(){
				uni.navigateTo({
					url:'xinjianren?type='+1
				})
			},
			getren(){
				this.$get(this.base+'/prod-api/api/hospital/patient/list').then((res)=>{
					this.content = res.rows
				})
			},
			fillstr(str){
				if(str == null){
					return str
				}
				let ste1 = (str.length - 5)*1
				return str.substring(0,ste1)+'****'
			}
		}
	}
</script>

<style>

</style>
